home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga News 95
/
Amiga News 95.iso
/
dpat
/
dpat01
/
megaboot
/
mega_boot.lst
< prev
next >
Wrap
File List
|
1992-02-29
|
8KB
|
413 lines
$m4096
'
RESERVE 70*1024
np$="RAM:"
n$=""
'
~SetTaskPri(FindTask(0),-1)
SETWPEN 1,4
OPENS 1,0,0,640,256,3,&H8000
TITLES #1," "
OPENW #1,0,0,640,256,&H0,256+4096
CLEARW #1
DIM c%(8),col$(2),bp%(2),a$(50),screen$(3)
@picture
@get_screen
'
n&=0
REPEAT
READ a$(n&)
INC n&
UNTIL a$(PRED(n&))="*"
'
DATA FICHIERS , LOAD, SAVE , SAVE AS ... , QUITTER ,
DATA BOOT OPTIONS , LOAD BOOT , SAVE BOOT , DUMP BOOT , MAKE CHECKSUM , UNDO CHECKSUM ,
DATA DRIVES , DF0: , DF1:, DF2:, DF3: ,,,*
MENU a$()
'
MENU KEY 1,ASC("L")
MENU KEY 2,ASC("S")
MENU KEY 3,ASC("A")
MENU KEY 4,ASC("Q")
MENU KEY 5,ASC("$")
MENU KEY 7,ASC("R")
MENU KEY 8,ASC("W")
MENU KEY 9,ASC("D")
MENU KEY 10,ASC("M")
MENU KEY 11,ASC("U")
MENU KEY 14,ASC("0")
MENU KEY 15,ASC("1")
MENU KEY 16,ASC("2")
MENU KEY 17,ASC("3")
'
ON MENU GOSUB choix
unit&=0
MENU 14,256+64+16+2
'
@initasm
buffer%=AllocMem(1024,&H10002)
'
IF buffer%>0
exitflag!=0
REPEAT
SLEEP
@memory
UNTIL exitflag!
VOID FreeMem(buffer%,1024)
ELSE
@scrolling_texte("SORRY ! VOUS N'AVEZ PLUS DE CHIP-RAM (J'ME CASSE ...) ",31,31,31,-250)
ENDIF
~SetTaskPri(FindTask(0),0)
CLOSEW #0
CLOSES 1
CLEAR
EDIT
'
PROCEDURE memory
COLOR 6
TEXT 163,226,STR$(AvailMem(&H4))+" OCTETS "
TEXT 163,209,STR$(AvailMem(&H2))+" OCTETS "
RETURN
'
PROCEDURE choix
c$=UPPER$(TRIM$(a$(MENU(0))))
IF MENU(0)>=14 AND MENU(0)<=17
MENU 14+unit&,64+16+2
MENU MENU(0),256+64+16+2
unit&=MENU(0)-14
nom!=0
np$=TRIM$(c$)
ENDIF
'
IF c$="MAKE CHECKSUM"
@put_screen
@dochecksum
@afficher
ENDIF
'
IF c$="UNDO CHECKSUM"
@dochecksum
LPOKE buffer%+4,NOT LPEEK(buffer%+4)
@afficher
ENDIF
'
IF c$="LOAD BOOT"
@put_screen
erreur&=@readtrack(unit&,buffer%,0,1024)
IF erreur&
@scrolling_texte("SORRY ! IL DOIT Y AVOIR UNE ERREUR SUR LE DISK DU DRIVE DF"+STR$(unit&)+" !",0,31,0,-250)
ELSE
tampon!=TRUE
@afficher
ENDIF
ENDIF
'
IF c$="SAVE BOOT"
IF tampon!
@scrolling_rapide("VOULEZ-VOUS SAUVER LE BOOT SUR DF"+STR$(unit&)+": (Y/N) ? ",31,0,0,630,258)
'
REPEAT
rep$=UPPER$(INKEY$)
UNTIL rep$="Y" OR rep$="N"
'
@scrolling_rapide("VOULEZ-VOUS SAUVER LE BOOT SUR DF"+STR$(unit&)+": (Y/N) ? ",31,0,0,260,-150)
'
IF rep$="Y"
erreur&=@writetrack(unit&,buffer%,0,1024)
IF erreur&
@scrolling_texte("SORRY ! IL DOIT Y AVOIR UNE ERREUR SUR LE DISK DU DRIVE DF"+STR$(unit&)+" !",0,31,31,-250)
ENDIF
ENDIF
'
ELSE
@scrolling_texte("IL N'Y A PAS DE BOOT-BLOCK EN MEMOIRE !",31,31,0,-110)
ENDIF
ENDIF
'
IF c$="DUMP BOOT"
@afficher
ENDIF
'
IF c$="LOAD"
FILESELECT "CHARGEMENT D'UN FICHIER"," LOAD ",np$,n$
IF n$<>""
@put_screen
np$=n$
nom!=1
erreur&=FALSE
ON ERROR GOSUB errdisk
OPEN "i",#1,np$
IF NOT erreur&
IF LOF(#1)>1024
@scrolling_texte("LA TAILLE DU FICHIER EST > 1024 OCTETS ! ",31,31,15,-110)
ELSE
tampon!=TRUE
BGET #1,buffer%,LOF(#1)
@afficher
ENDIF
CLOSE #1
ENDIF
ENDIF
ENDIF
'
IF c$="SAVE" AND nom!
ON ERROR GOSUB errdisk
BSAVE np$,buffer%,1024
ENDIF
'
IF c$="SAVE AS ..." OR (c$="SAVE" AND nom!=0)
IF tampon!
FILESELECT "SAUVEGARDE D'UN FICHIER"," SAVE ",np$,n$
IF n$<>""
np$=n$
nom!=1
ON ERROR GOSUB errdisk
BSAVE np$,buffer%,1024
ENDIF
ELSE
@scrolling_texte("IL N'Y A PAS DE BOOT-BLOCK EN MEMOIRE ! ",31,0,31,-110)
ENDIF
ENDIF
'
IF c$="QUITTER"
@scrolling_rapide("VOULEZ-VOUS VRAIMENT QUITTER MEGA BOOT ? (Y/N) :",31,31,0,630,254)
'
REPEAT
rep$=UPPER$(INKEY$)
UNTIL rep$="Y" OR rep$="N"
'
@scrolling_rapide("VOULEZ-VOUS VRAIMENT QUITTER MEGA BOOT ? (Y/N) : ",31,31,0,250,-150)
'
IF rep$="Y"
exitflag!=1
ELSE
exitflag!=0
ENDIF
ENDIF
'
RETURN
'
PROCEDURE errdisk
erreur&=TRUE
@scrolling_texte("SORRY ! IL DOIT Y AVOIR UNE ERREUR SUR LE DISK DU DRIVE DF"+STR$(unit&)+" ! ",10,31,10,-250)
RESUME NEXT
RETURN
'
PROCEDURE fin
exitflag!=1
RETURN
'
PROCEDURE afficher
@put_screen
s%=LPEEK(buffer%+4)
@dochecksum
sn%=LPEEK(buffer%+4)
LPOKE buffer%+4,s%
IF sn%=s%
COLOR 6
TEXT 164,243,"GOOD !"
ELSE
COLOR 6
TEXT 164,243,"BAD ! "
ENDIF
'
FOR a%=0 TO 15
l$=""
FOR b%=a%*64+buffer% TO a%*64+buffer%+63
c|=PEEK(b%)
IF c|<127 AND c|>31
l$=l$+CHR$(c|)
ELSE
l$=l$+"."
ENDIF
NEXT b%
GRAPHMODE 8
COLOR 0
TEXT 25,60+a%*8,"$"+HEX$(a%*64,4)+" "+l$
COLOR 6
TEXT 28,58+a%*8,"$"+HEX$(a%*64,4)+" "+l$
GRAPHMODE 1
NEXT a%
RETURN
'
PROCEDURE dochecksum
LPOKE buffer%+4,0
r%(8)=buffer%
RCALL V:asm$,r%()
LPOKE buffer%+4,r%(0)
RETURN
'
asm:
DATA $323C,$00FF,$7000,$D098,$6400,$0004,$5240,$51C9,$FFF6,$4680,$4E75
'
PROCEDURE initasm
LOCAL a%,b%
DIM r%(31)
RESTORE asm
asm$=""
FOR a%=0 TO 10
READ b%
asm$=asm$+MKI$(b%)
NEXT a%
RETURN
'
' **********************************************************************
' * *
' * ROUTINES DE LECTURE/ECRITURE DES PISTES *
' * *
' **********************************************************************
'
FUNCTION readtrack(unit&,adr%,offset%,len%)
LOCAL e%,diskio$,readreply$,trackname$
diskio$=STRING$(20*4,0)
readreply$=STRING$(8*4,0)
trackname$="trackdisk.device"
'
LPOKE V:readreply$+16,FindTask(0)
e%=AddPort(V:readreply$)
'
IF e%>0
e%=OpenDevice(V:trackname$,unit&,V:diskio$,0)
IF e%=0
LPOKE V:diskio$+14,V:readreply$
DPOKE V:diskio$+28,2
LPOKE V:diskio$+40,adr%
LPOKE V:diskio$+36,len%
LPOKE V:diskio$+44,offset%
error&=DoIO(V:diskio$)
'
IF BYTE{V:diskio$+31}<>0 OR error&
error&=TRUE
ELSE
error&=FALSE
ENDIF
'
DPOKE V:diskio$+28,9
LPOKE V:diskio$+36,0
VOID DoIO(V:diskio$)
'
VOID CloseDevice(V:diskio$)
ELSE
error&=TRUE
ENDIF
VOID RemPort(V:readreply$)
ELSE
error&=TRUE
ENDIF
RETURN error&
ENDFUNC
'
FUNCTION writetrack(unit&,adr%,offset%,len%)
LOCAL e%,diskio$,readreply$,trackname$
diskio$=STRING$(20*4,0)
readreply$=STRING$(8*4,0)
trackname$="trackdisk.device"
'
LPOKE V:readreply$+16,FindTask(0)
e%=AddPort(V:readreply$)
'
IF e%>0
e%=OpenDevice(V:trackname$,unit&,V:diskio$,0)
IF e%=0
LPOKE V:diskio$+14,V:readreply$
DPOKE V:diskio$+28,3
LPOKE V:diskio$+40,adr%
LPOKE V:diskio$+36,len%
LPOKE V:diskio$+44,offset%
error&=DoIO(V:diskio$)
'
IF BYTE{V:diskio$+31}<>0 OR error&
error&=TRUE
ELSE
error&=FALSE
ENDIF
'
DPOKE V:diskio$+28,4
VOID DoIO(V:diskio$)
'
DPOKE V:diskio$+28,9
LPOKE V:diskio$+36,0
VOID DoIO(V:diskio$)
'
VOID CloseDevice(V:diskio$)
ELSE
error&=TRUE
ENDIF
VOID RemPort(V:readreply$)
ELSE
error&=TRUE
ENDIF
RETURN error&
ENDFUNC
'
> PROCEDURE picture
INLINE bp1%,20480
INLINE bp2%,20480
INLINE bp3%,20480
bp%(0)=bp1%
bp%(1)=bp2%
bp%(2)=bp3%
@color
FOR a|=0 TO 2
col$(a|)=SPACE$(20480)
BMOVE bp%(a|),V:col$(a|),20480
NEXT a|
SPUT col$()
ERASE col$()
RETURN
'
> PROCEDURE color
INLINE col%,16
FOR v&=1 TO 8
c%(v&)={ADD(col%,ADD(v&,v&))}
SETCOLOR v&,c%(v&)
NEXT v&
FOR i=0 TO 1
FOR a|=1 TO 8
SETCOLOR a|,c%(a|)
NEXT a|
INSERT c%(1)=c%(8)
NEXT i
SETCOLOR 1,3,26,30
RETURN
'
> PROCEDURE get_screen
SGET screen$()
RETURN
'
> PROCEDURE put_screen
SPUT screen$()
RETURN
'
> PROCEDURE scrolling_texte(texte$,tr,tv,tb,dep_x)
'
CLIP 254,234 TO 630,246
'
SETCOLOR 7,tr,tv,tb
COLOR 7
'
FOR t%=640 TO dep_x STEP -3
TEXT t%,243,texte$
VSYNC
NEXT t%
'
CLIP 0,0 TO 640,256
'
RETURN
'
> PROCEDURE scrolling_rapide(texte$,tr,tv,tb,depart,dep_x)
'
CLIP 254,234 TO 630,246
'
SETCOLOR 7,tr,tv,tb
COLOR 7
'
FOR t%=depart TO dep_x STEP -10
TEXT t%,243,texte$
VSYNC
NEXT t%
'
CLIP 0,0 TO 640,256
'
RETURN